// import interface.
#include <windows.h>
#include <assert.h>
#include <stdio.h>

int main(int argc, char* argv[]) {
	FILE* pf;

	printf("get makefile template file.\n");
	pf = fopen(".\\makefile", "r");
	if (pf != NULL) {
		printf("Current directory \'makefile\' file already exist.\n");
		fclose(pf);
		return 0;
	} else {
		char buf[MAX_PATH];
		DWORD size;
		size = GetModuleFileName(GetModuleHandle(NULL), buf, MAX_PATH);
		--size;
		while (1) {
			if (buf[size] == '\\') {
				++size;
				buf[size] = '\0';
				break;
			} else {
				--size;
			}
		}
		strcat(buf, "template_makefile");
		{
			pf = fopen(buf, "r");
			if (pf == NULL) {
				printf("file \'%s\' not exist.\n", buf);
				return 0;
			} else {
				CopyFile(buf, ".\\makefile", FALSE);
				fclose(pf);
			}
		}
	}
	return 0;
}
